package se.nikmel.AnDisper.Application;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class ApplicationCache implements Iterable<Application>
{
	private Map<String, Application> m_mapKnownApps;
	
	public ApplicationCache(List<Application> p_lstApps){
		m_mapKnownApps = new HashMap<String, Application>(p_lstApps.size());
		
		for(Application app : p_lstApps)
			m_mapKnownApps.put(app.getID(), app);	
	}
	
	public Application getApp(String p_sAppID){
		return m_mapKnownApps.get(p_sAppID);		
	}

	public Iterator<Application> iterator() {
		return m_mapKnownApps.values().iterator();
	}
}
